package com.lzx.adx.report.support.context;

import com.lzs.adx.commmon.utils.SpringContextUtils;
import com.lzx.adx.report.support.strategy.channel.AbstractReport;

import java.util.Map;

public class HandlerReportContext {

    private Map<String,Class> reportMap;

    public HandlerReportContext(Map<String,Class> reportMap){
        this.reportMap=reportMap;
    }


    public AbstractReport getReport(String reportType){
        Class aClass = reportMap.get(reportType);
        if(aClass==null){
            throw new RuntimeException("没有找到对应的产品");
        }
        return (AbstractReport) SpringContextUtils.getBean(aClass);
    }
}
